home *** CD-ROM | disk | FTP | other *** search
/ Aventura Visual - História Do Mundo / Aventura Visual - História do Mundo.img / dksetup / win32s.inc < prev   
Text File  |  1997-02-14  |  24KB  |  652 lines

  1. '**************************************************************************
  2. '*                  MS Test script for Win32s setup program
  3. '**************************************************************************
  4.  
  5. ''GetTempFileName flags
  6. CONST TF_FORCEDRIVE            = 128
  7.  
  8. GLOBAL DEST32S$      ''Windows\System\Win32s directory
  9. GLOBAL DESTFREE$     ''Freecell directory
  10. GLOBAL OLE_PROTECT%  ''Indicates whether ole2 dlls were protected from being
  11.                      '' copied.
  12. GLOBAL OLE_OLEBOOT%
  13. GLOBAL VERNUM$       '' Win32s Version Number (i.e., for v1.25 VERNUM$="125"
  14.  
  15. DECLARE SUB InstallW32s(OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%)
  16. DECLARE SUB RecoverFromCopy(szFileName$)
  17. DECLARE SUB UpdateSystemIni
  18. DECLARE FUNCTION RebootSystem(OLEONLY%) AS INTEGER
  19. DECLARE FUNCTION MakeSystemIni LIB "INIUPD.DLL" (arg1$, arg2$) AS INTEGER
  20. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  21. DECLARE FUNCTION PagingEnabled LIB "INIUPD.DLL" AS INTEGER
  22. DECLARE FUNCTION ShareEnabled LIB "INIUPD.DLL" AS INTEGER
  23. DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER
  24. DECLARE FUNCTION IsRunningApp LIB "INIUPD.DLL" AS INTEGER
  25. 'DECLARE FUNCTION SetCuiFlags LIB "MSCUISTF.DLL" (arg1%, arg2%) AS INTEGER
  26. DECLARE FUNCTION GetModuleHandle LIB "KRNL386.EXE" (arg1$) AS INTEGER
  27. DECLARE FUNCTION LoadLibrary LIB "KRNL386.EXE" (arg1$) AS INTEGER
  28. DECLARE SUB FreeLibrary LIB "KRNL386.EXE" (arg1%)
  29. DECLARE FUNCTION SetErrorMode LIB "KRNL386.EXE" (arg1%) AS INTEGER
  30.  
  31. DECLARE FUNCTION GetTempFileName LIB "KRNL386.EXE" (drive%, prefix$, u%, filename$) AS INTEGER
  32. DECLARE SUB WriteLine LIB "INIUPD.DLL" (filename$, text$)
  33. DECLARE FUNCTION GetTempFileAt(szDir$, szPrefix$) as string
  34. '
  35. '------------------------------------------------------------------------------
  36. '
  37.     szOldVer$ ="1.00.000     "          '' Reserve space in string for version
  38.     WIN32ENABLED% = 0
  39.     OLEONLY% = 0
  40.     OLE2_16% = 0
  41.     OLE2AUTO_16% = 0
  42.     OLE16RUNAPP% = 0
  43.     OLE_PROTECT% = 0
  44.     OLE_OLEBOOT% = 0
  45.  
  46. 'Start in DKSETUP.MST NOT HERE!!!
  47.     goto init
  48.  
  49. InstallWin32s:
  50. '    ON ERROR GOTO ERRNORMAL
  51.  
  52.     WIN32SVER$ = MID$(GetSectionKeyVersion("WindowsSystem", "win32s16"), 1, 4)
  53. '    SetTitle "Microsoft Win32s version " + WIN32SVER$ + " Setup Program"
  54.     VERNUM$ = MID$(WIN32SVER$, 1, 1) + MID$(WIN32SVER$, 3 , 2)
  55.  
  56.     DEST32S$ = szWinSysPath + "WIN32S\"
  57.  
  58. '$IFDEF DEBUG
  59.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  60.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  61.     IF IsDriveValid(WinDrive$) = 0 THEN
  62.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  63.         GOTO QUITW32S
  64.     END IF
  65. '$ENDIF ''DEBUG
  66.  
  67. CHECKW32S:
  68.     '' Check that we are not running on Chicago, including pre-released
  69.     '' Chicago versions.
  70.     IF GetWindowsMajorVersion * 100 + GetWindowsMinorVersion > 350 THEN
  71.         ExitCode% = EXITSUCCESS
  72.         WIN32ENABLED% = 1
  73. '        GOTO FREECELL
  74.     END IF
  75.     IF GetWindowsMode < 2  THEN
  76.         IF OnWindowsNT() THEN
  77.             ExitCode% = IDD_EXITFAILNOTINTEL '' Running on Windows NT (on RISC)
  78.         ELSE
  79.             ExitCode% = IDD_EXITFAILNOTENH   '' Standard Mode Windows
  80.         END IF
  81.         GOTO QUITW32S
  82.     END IF
  83.     IF OnWindowsNT() THEN
  84.         ExitCode% = EXITSUCCESS
  85.         WIN32ENABLED% = 1
  86. '        GOTO FREECELL
  87.     END IF
  88.     ExitCode% = EXITSUCCESS
  89.  
  90. ' Stupid place to put this! So I've moved to after we have decided if
  91. ' they already have win32s or not..
  92. '    If IsRunningApp() <> 0 THEN
  93. '        ExitCode% = IDD_EXITFAILRUNAPP
  94. '        GOTO QUITW32S
  95. '    END IF
  96.  
  97.     '' Get version of Win32s to be installed from version info in INF file
  98.     szNewVer$ = GetSectionKeyVersion("WindowsSystem", "win32s16")
  99.  
  100.     '' See if OLE is included.
  101.  
  102.     OLEINCLUDED% = DoesFileExist( szSrcBinPath + "\OLE2THK.DL_", femExists )
  103.  
  104.     IF OLEINCLUDED% = 1 THEN
  105.         '' See whether one of the OLE 16 bit components is loaded.
  106.         IF GetModulehandle("compobj") <> 0 THEN
  107.             OLE16RUNAPP% = 1
  108.             GOTO GetOleVersion
  109.         END IF
  110.         IF GetModuleHandle("ole2") <> 0 THEN
  111.             OLE16RUNAPP% = 1
  112.             GOTO GetOleVersion
  113.         END IF
  114.         IF GetModuleHandle("ole2prox") <> 0 THEN
  115.             OLE16RUNAPP% = 1
  116.             GOTO GetOleVersion
  117.         END IF
  118.         IF GetModuleHandle("ole2conv") <> 0 THEN
  119.             OLE16RUNAPP% = 1
  120.             GOTO GetOleVersion
  121.         END IF
  122.         IF GetModuleHandle("storage") <> 0 THEN
  123.             OLE16RUNAPP% = 1
  124.             GOTO GetOleVersion
  125.         END IF
  126.         IF GetModuleHandle("ole2nls") <> 0 THEN
  127.             OLE16RUNAPP% = 1
  128.             GOTO GetOleVersion
  129.         END IF
  130.         IF GetModuleHandle("ole2disp") <> 0 THEN
  131.             OLE16RUNAPP% = 1
  132.             GOTO GetOleVersion
  133.         END IF
  134.         IF GetModuleHandle("typelib") <> 0 THEN
  135.             OLE16RUNAPP% = 1
  136.             GOTO GetOleVersion
  137.         END IF
  138.  
  139. GetOleVersion:
  140.         szOleNewVer$ = GetSectionKeyVersion("OleWindowsSystemWin32s", "ole2thk")
  141.  
  142.         '' Get version of currently installed OLE32 from version info of
  143.         '' ole2thk file
  144.         szOleOldVer$ = GetVersionOfFile( szWinSysPath + "WIN32S\OLE2THK.DLL" )
  145.  
  146.         szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "COMPOBJ.DLL" )
  147.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "compobj")
  148.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  149.             OLE2_16% = 1
  150.         END IF
  151.  
  152.         szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2.DLL" )
  153.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2")
  154.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  155.             OLE2_16% = 1
  156.         END IF
  157.  
  158.         szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2PROX.DLL" )
  159.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2prox")
  160.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  161.             OLE2_16% = 1
  162.         END IF
  163.  
  164.         szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "STORAGE.DLL" )
  165.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "storage")
  166.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  167.             OLE2_16% = 1
  168.         END IF
  169.  
  170.         szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2CONV.DLL" )
  171.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2conv")
  172.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  173.             OLE2_16% = 1
  174.         END IF
  175.  
  176.         szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2NLS.DLL" )
  177.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2nls")
  178.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  179.             OLE2AUTO_16% = 1
  180.         END IF
  181.  
  182.         szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "OLE2DISP.DLL" )
  183.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2disp")
  184.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  185.             OLE2AUTO_16% = 1
  186.         END IF
  187.  
  188.         szOle16OldVer$ = GetVersionOfFile( szWinSysPath + "TYPELIB.DLL" )
  189.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "typelib")
  190.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  191.             OLE2AUTO_16% = 1
  192.         END IF
  193.  
  194.     END IF
  195.  
  196.     OLE2_32% = OLEINCLUDED%
  197.  
  198.     '' Check if Win32s is partially installed
  199.     sz$ = GetIniKeyString (szWinSysPath + "WIN32S.INI", "Win32s", "Setup")
  200.     '' If WIN32S.INI specifies Win32s Setup=0, then force complete Win32s file overwrite
  201.     IF sz$ = "0" THEN
  202.         GOTO INSTW32S
  203.     END IF
  204.     '' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI
  205.     IF sz$ <> "1" THEN
  206.         GOTO INSTW32S
  207.     END IF
  208.  
  209.     '' If Win32s is already installed, get running version number
  210.     i% = DoesFileExist( szWinSysPath + "W32SYS.DLL", femExists )
  211.     IF i% = 1 THEN
  212.         i% = IsWin32sLoaded( szOldVer$ )
  213.     ENDIF
  214.  
  215.     IF i% = 0 THEN
  216.         GOTO INSTW32S
  217.     END IF
  218.  
  219.     IF szNewVer$ > szOldVer$ THEN
  220.         GOTO INSTW32S
  221.     END IF
  222.  
  223.     IF OLEINCLUDED% = 1 THEN
  224.  
  225.